<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/default.xhtml"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

	<f:metadata>
		<f:viewParam name="moduleName" value="按资质类型"></f:viewParam>
	</f:metadata>
	<ui:define name="head">
		<h:outputStylesheet name="css/public/tab.css" />
		<h:outputStylesheet name="css/public/table.css" />
		<script>
		
		</script>
	</ui:define>
	<ui:define name="content">
		<h:form>
			<div style="margin: 10px auto;">
				
				<p:outputLabel value="成交日期：" style="display:inline-bloack;margin-top:10px;"></p:outputLabel>
				<p:calendar  styleClass="startDate" locale="zh_CN"
					navigator="true" pattern="yyyy-MM-dd"  />
				至
				<p:calendar  styleClass="endDate"	locale="zh_CN"
					navigator="true" pattern="yyyy-MM-dd" />
					#{ ' '}
					<p:commandButton value="查询" styleClass="queryBtn" ></p:commandButton>
					#{ ' '}
					<p:commandButton value="重置"  ajax="false" action="QualificationClassStat.xhtml" ></p:commandButton>	
			</div>
			<p:commandButton value="导出" ajax="false" style="margin:10px;">
	   			<p:fileDownload value="#{statExport.qualificationClassStatExport()}" />
	   		</p:commandButton>
			<table border="1" class="reqTable table" >
				<thead>
					<tr>
						<th >资质类型</th>
						<th >公告数</th>
						<th >累计成交金额(元)</th>
						<th >参与报名次数</th>
					</tr>
				
				</thead>
				<tbody>
				</tbody>
			</table>
			<div id="page" class="page_div"></div>
		</h:form>
		<script type="text/javascript">
			var contextPath = '${request.getContextPath()}';
			$(function(){	
				$(".queryBtn").click(function(){
					init();
				});	
				init();
			})
			// <![CDATA[
			function init(){
				var totalCount = stat(contextPath);	
			}
			function stat(contextPath){
				var startDate = $(".startDate").find("input").val();
			 	var endDate = $(".endDate").find("input").val();
				var url = contextPath+"/rest/qualificationClass/getQualificationClassStat?startDate="+startDate+"&endDate="+endDate;
				debugger;
				$.ajax({
					url:url,
					async:false,
					success:function(data){
						var html = "";
						for(var index in data){
							var stat = data[index];
							html += "<tr>";
								html +="<td>"+stat.dataStr+"</td>";
								html +="<td>"+stat.count+"</td>";
								html +="<td>"+stat.priceCount+"</td>";
								html +="<td>"+stat.appliedCount+"</td>";
							html += "</tr>";
						}
						$(".reqTable").find("tbody").html(html);
					}
				});
			}
			
			// ]]>
		</script>
	</ui:define>
</ui:composition>